"""
取消订单
"""
import os
import sys
import django
import datetime

base_url = os.path.split(os.path.split(os.getcwd())[0])[0]
print(base_url)
sys.path.insert(0, os.path.split(os.path.split(os.getcwd())[0])[0])
os.environ['DJANGO_SETTINGS_MODULE'] = 'finance_c2c.settings'
django.setup()

from core.tl.client import TLClient, TLTransfer, get_TLTransfer, get_TLClient
from core.tools.models import PublicPrivate
from urllib import parse
from core.tools.encryption import hashlib_md5
from core.tools.func_utils import funcUtils
from core.tools.get_datetime import GetDateTime
from core.tools.func_utils import FuncUtils

if __name__ == '__main__':
    # h5_client = get_TLClient()
    h5_client = get_TLClient("TLjy001")
    # 支付
    order_datetime = GetDateTime.format_datetime()
    print(order_datetime)
    pickupUrl = "https://c2c.kalaibao.com/api/tl/pay-test"
    receiveUrl = "https://c2c.kalaibao.com/api/tl/pay-test"
    order_no = FuncUtils().unique_value
    h5_pay_url = h5_client.h5pay_api("385", "18862235597", "20", order_datetime, pickupUrl=pickupUrl,
                                     receiveUrl=receiveUrl)
    print(h5_pay_url)
    # 退款
    # order_no = "20032917332333399043"  # 老
    # order_no = "20033017222792183631"
    # order_datetime = "20200330172227"
    # out_refund_no = FuncUtils().unique_value
    # response = h5_client.refund_api(1, order_no, order_datetime, out_refund_no)
